package com.cdp.web.controller.system;

import com.cdp.common.core.domain.AjaxResult;
import com.cdp.common.core.domain.entity.SysFlyash;
import com.cdp.system.dto.FlyashDTO;
import com.cdp.system.dto.FlyashSecondDTO;
import com.cdp.system.service.ISysFlyashService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.math3.geometry.partitioning.AbstractRegion;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
@Slf4j
@RestController
@RequestMapping("/system/flyash")
public class SysFlyashController {


    @Autowired
    private ISysFlyashService sysFlyashService;

    @GetMapping("listFlyash")
    private AjaxResult listFlyash() {
        List<SysFlyash> flyashList = sysFlyashService.listFlyash();
        return AjaxResult.success(flyashList);
    }




    /**
     * 粉煤灰模糊查询
     */
   // @PostMapping("listMistedFlyash")
    private AjaxResult listMistedFlyash(@RequestBody FlyashDTO flyashDTO) {


        // 执行业务逻辑
        try {

            return  sysFlyashService.listMistedFlyash(flyashDTO);
        } catch (Exception e) {
            log.error("查询执行时发生错误，参数为: {}", flyashDTO, e);
            return AjaxResult.error("系统内部错误，请稍后重试。");
        }
    }



    /**
     * 粉煤灰模糊查询
     */
   // @PostMapping("listMistedFlyashSecond")
    @PostMapping("listMistedFlyash")
    private AjaxResult listMistedFlyashSecond(@RequestBody FlyashSecondDTO flyashSecondDTO) {

        // 执行业务逻辑
        try {

            return  sysFlyashService.listMistedFlyashSecond(flyashSecondDTO);
        } catch (Exception e) {
            log.error("查询执行时发生错误，参数为: {}", flyashSecondDTO, e);
            return AjaxResult.error("系统内部错误，请稍后重试。");
        }
    }






}
